import { S } from '../s';
import { IPSAppLan } from './ipsapp-lan';
import { IPSAppMethodDTO } from './ipsapp-method-dto';
import { IPSAppResource } from './ipsapp-resource';
import { IPSAppUtilPage } from './ipsapp-util-page';
import { IPSApplication } from './ipsapplication';
import { IPSApplicationLogic } from './ipsapplication-logic';
import { IPSSubAppRef } from './ipssub-app-ref';
import { IPSAppMenuModel } from './appmenu/ipsapp-menu-model';
import { IPSAppCodeList } from './codelist/ipsapp-code-list';
import { IPSAppPortlet } from './control/ipsapp-portlet';
import { IPSAppPortletCat } from './control/ipsapp-portlet-cat';
import { IPSAppDERS } from './dataentity/ipsapp-ders';
import { IPSAppDEUIAction } from './dataentity/ipsapp-deuiaction';
import { IPSAppDataEntity } from './dataentity/ipsapp-data-entity';
import { IPSAppFunc } from './func/ipsapp-func';
import { IPSAppUILogic } from './logic/ipsapp-uilogic';
import { IPSAppMsgTempl } from './msg/ipsapp-msg-templ';
import { IPSAppPFPluginRef } from './res/ipsapp-pfplugin-ref';
import { IPSAppUITheme } from './theme/ipsapp-uitheme';
import { IPSAppUtil } from './util/ipsapp-util';
import { IPSAppIndexView } from './view/ipsapp-index-view';
import { IPSAppView } from './view/ipsapp-view';
import { IPSAppViewMsg } from './view/ipsapp-view-msg';
import { IPSAppViewMsgGroup } from './view/ipsapp-view-msg-group';
import { IPSAppWF } from './wf/ipsapp-wf';
import { IPSDEOPPriv } from '../dataentity/priv/ipsdeoppriv';
import { IPSSysCss } from '../res/ipssys-css';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSApplicationImpl
  extends PSModelObjectImpl
  implements IPSApplication
{
  protected allaccesskeys: string[];
  getAllAccessKeys(): string[] | null {
    if (this.allaccesskeys == null) {
      const value = this.M.allAccessKeys;
      if (value == null) {
        return null;
      }
      const arrayNode: any[] = value;
      if (arrayNode.length == 0) {
        return null;
      }
      const list: string[] = [];
      for (let i = 0; i < arrayNode.length; i++) {
        list.push(arrayNode[i]);
      }
      this.allaccesskeys = list;
    }
    return this.allaccesskeys.length == 0 ? null : this.allaccesskeys;
  }

  protected allpsappcodelists: IPSAppCodeList[];
  getAllPSAppCodeLists(): IPSAppCodeList[] | null {
    return (
      this.allpsappcodelists ||
      (this.allpsappcodelists = this.fillChildListModel(
        this.M.getAllPSAppCodeLists,
        S._8,
      ) as IPSAppCodeList[])
    );
  }

  findPSAppCodeList(objKey: any): IPSAppCodeList | null {
    return this.getPSModel5(
      S._8,
      this.getAllPSAppCodeLists(),
      objKey,
    ) as IPSAppCodeList;
  }

  protected allpsappderss: IPSAppDERS[];
  getAllPSAppDERSs(): IPSAppDERS[] | null {
    return (
      this.allpsappderss ||
      (this.allpsappderss = this.fillChildListModel(
        this.M.getAllPSAppDERSs,
        S._e,
      ) as IPSAppDERS[])
    );
  }

  findPSAppDERS(objKey: any): IPSAppDERS | null {
    return this.getPSModel5(
      S._e,
      this.getAllPSAppDERSs(),
      objKey,
    ) as IPSAppDERS;
  }

  protected allpsappdeuiactions: IPSAppDEUIAction[];
  getAllPSAppDEUIActions(): IPSAppDEUIAction[] | null {
    return (
      this.allpsappdeuiactions ||
      (this.allpsappdeuiactions = this.fillChildListModel(
        this.M.getAllPSAppDEUIActions,
        S._286,
      ) as IPSAppDEUIAction[])
    );
  }

  findPSAppDEUIAction(objKey: any): IPSAppDEUIAction | null {
    return this.getPSModel5(
      S._286,
      this.getAllPSAppDEUIActions(),
      objKey,
    ) as IPSAppDEUIAction;
  }

  protected allpsappdataentities: IPSAppDataEntity[];
  getAllPSAppDataEntities(): IPSAppDataEntity[] | null {
    return (
      this.allpsappdataentities ||
      (this.allpsappdataentities = this.fillChildListModel(
        this.M.getAllPSAppDataEntities,
        S._f,
      ) as IPSAppDataEntity[])
    );
  }

  findPSAppDataEntity(objKey: any): IPSAppDataEntity | null {
    return this.getPSModel5(
      S._f,
      this.getAllPSAppDataEntities(),
      objKey,
    ) as IPSAppDataEntity;
  }

  protected allpsappfuncs: IPSAppFunc[];
  getAllPSAppFuncs(): IPSAppFunc[] | null {
    return (
      this.allpsappfuncs ||
      (this.allpsappfuncs = this.fillChildListModel(
        this.M.getAllPSAppFuncs,
        S._10,
      ) as IPSAppFunc[])
    );
  }

  findPSAppFunc(objKey: any): IPSAppFunc | null {
    return this.getPSModel5(
      S._10,
      this.getAllPSAppFuncs(),
      objKey,
    ) as IPSAppFunc;
  }

  protected allpsapplans: IPSAppLan[];
  getAllPSAppLans(): IPSAppLan[] | null {
    return (
      this.allpsapplans ||
      (this.allpsapplans = this.fillChildListModel(
        this.M.getAllPSAppLans,
        S._12,
      ) as IPSAppLan[])
    );
  }

  findPSAppLan(objKey: any): IPSAppLan | null {
    return this.getPSModel5(S._12, this.getAllPSAppLans(), objKey) as IPSAppLan;
  }

  protected allpsappmenumodels: IPSAppMenuModel[];
  getAllPSAppMenuModels(): IPSAppMenuModel[] | null {
    return (
      this.allpsappmenumodels ||
      (this.allpsappmenumodels = this.fillChildListModel(
        this.M.getAllPSAppMenuModels,
        S._219,
      ) as IPSAppMenuModel[])
    );
  }

  findPSAppMenuModel(objKey: any): IPSAppMenuModel | null {
    return this.getPSModel5(
      S._219,
      this.getAllPSAppMenuModels(),
      objKey,
    ) as IPSAppMenuModel;
  }

  protected allpsappmethoddtos: IPSAppMethodDTO[];
  getAllPSAppMethodDTOs(): IPSAppMethodDTO[] | null {
    return (
      this.allpsappmethoddtos ||
      (this.allpsappmethoddtos = this.fillChildListModel(
        this.M.getAllPSAppMethodDTOs,
        S._3ed,
      ) as IPSAppMethodDTO[])
    );
  }

  findPSAppMethodDTO(objKey: any): IPSAppMethodDTO | null {
    return this.getPSModel5(
      S._3ed,
      this.getAllPSAppMethodDTOs(),
      objKey,
    ) as IPSAppMethodDTO;
  }

  protected allpsappmsgtempls: IPSAppMsgTempl[];
  getAllPSAppMsgTempls(): IPSAppMsgTempl[] | null {
    return (
      this.allpsappmsgtempls ||
      (this.allpsappmsgtempls = this.fillChildListModel(
        this.M.getAllPSAppMsgTempls,
        S._37c,
      ) as IPSAppMsgTempl[])
    );
  }

  findPSAppMsgTempl(objKey: any): IPSAppMsgTempl | null {
    return this.getPSModel5(
      S._37c,
      this.getAllPSAppMsgTempls(),
      objKey,
    ) as IPSAppMsgTempl;
  }

  protected allpsapppfpluginrefs: IPSAppPFPluginRef[];
  getAllPSAppPFPluginRefs(): IPSAppPFPluginRef[] | null {
    return (
      this.allpsapppfpluginrefs ||
      (this.allpsapppfpluginrefs = this.fillChildListModel(
        this.M.getAllPSAppPFPluginRefs,
        S._3d7,
      ) as IPSAppPFPluginRef[])
    );
  }

  findPSAppPFPluginRef(objKey: any): IPSAppPFPluginRef | null {
    return this.getPSModel5(
      S._3d7,
      this.getAllPSAppPFPluginRefs(),
      objKey,
    ) as IPSAppPFPluginRef;
  }

  protected allpsappportletcats: IPSAppPortletCat[];
  getAllPSAppPortletCats(): IPSAppPortletCat[] | null {
    return (
      this.allpsappportletcats ||
      (this.allpsappportletcats = this.fillChildListModel(
        this.M.getAllPSAppPortletCats,
        S._c,
      ) as IPSAppPortletCat[])
    );
  }

  findPSAppPortletCat(objKey: any): IPSAppPortletCat | null {
    return this.getPSModel5(
      S._c,
      this.getAllPSAppPortletCats(),
      objKey,
    ) as IPSAppPortletCat;
  }

  protected allpsappportlets: IPSAppPortlet[];
  getAllPSAppPortlets(): IPSAppPortlet[] | null {
    return (
      this.allpsappportlets ||
      (this.allpsappportlets = this.fillChildListModel(
        this.M.getAllPSAppPortlets,
        S._d,
      ) as IPSAppPortlet[])
    );
  }

  findPSAppPortlet(objKey: any): IPSAppPortlet | null {
    return this.getPSModel5(
      S._d,
      this.getAllPSAppPortlets(),
      objKey,
    ) as IPSAppPortlet;
  }

  protected allpsappresources: IPSAppResource[];
  getAllPSAppResources(): IPSAppResource[] | null {
    return (
      this.allpsappresources ||
      (this.allpsappresources = this.fillChildListModel(
        this.M.getAllPSAppResources,
        S._3d5,
      ) as IPSAppResource[])
    );
  }

  findPSAppResource(objKey: any): IPSAppResource | null {
    return this.getPSModel5(
      S._3d5,
      this.getAllPSAppResources(),
      objKey,
    ) as IPSAppResource;
  }

  protected allpsappuilogics: IPSAppUILogic[];
  getAllPSAppUILogics(): IPSAppUILogic[] | null {
    return (
      this.allpsappuilogics ||
      (this.allpsappuilogics = this.fillChildListModel(
        this.M.getAllPSAppUILogics,
        S._280,
      ) as IPSAppUILogic[])
    );
  }

  findPSAppUILogic(objKey: any): IPSAppUILogic | null {
    return this.getPSModel5(
      S._280,
      this.getAllPSAppUILogics(),
      objKey,
    ) as IPSAppUILogic;
  }

  protected allpsappuithemes: IPSAppUITheme[];
  getAllPSAppUIThemes(): IPSAppUITheme[] | null {
    return (
      this.allpsappuithemes ||
      (this.allpsappuithemes = this.fillChildListModel(
        this.M.getAllPSAppUIThemes,
        S._14,
      ) as IPSAppUITheme[])
    );
  }

  findPSAppUITheme(objKey: any): IPSAppUITheme | null {
    return this.getPSModel5(
      S._14,
      this.getAllPSAppUIThemes(),
      objKey,
    ) as IPSAppUITheme;
  }

  protected allpsapputilpages: IPSAppUtilPage[];
  getAllPSAppUtilPages(): IPSAppUtilPage[] | null {
    return (
      this.allpsapputilpages ||
      (this.allpsapputilpages = this.fillChildListModel(
        this.M.getAllPSAppUtilPages,
        S._13,
      ) as IPSAppUtilPage[])
    );
  }

  findPSAppUtilPage(objKey: any): IPSAppUtilPage | null {
    return this.getPSModel5(
      S._13,
      this.getAllPSAppUtilPages(),
      objKey,
    ) as IPSAppUtilPage;
  }

  protected allpsapputils: IPSAppUtil[];
  getAllPSAppUtils(): IPSAppUtil[] | null {
    return (
      this.allpsapputils ||
      (this.allpsapputils = this.fillChildListModel(
        this.M.getAllPSAppUtils,
        S._15,
      ) as IPSAppUtil[])
    );
  }

  findPSAppUtil(objKey: any): IPSAppUtil | null {
    return this.getPSModel5(
      S._15,
      this.getAllPSAppUtils(),
      objKey,
    ) as IPSAppUtil;
  }

  protected allpsappviewmsggroups: IPSAppViewMsgGroup[];
  getAllPSAppViewMsgGroups(): IPSAppViewMsgGroup[] | null {
    return (
      this.allpsappviewmsggroups ||
      (this.allpsappviewmsggroups = this.fillChildListModel(
        this.M.getAllPSAppViewMsgGroups,
        S._85,
      ) as IPSAppViewMsgGroup[])
    );
  }

  findPSAppViewMsgGroup(objKey: any): IPSAppViewMsgGroup | null {
    return this.getPSModel5(
      S._85,
      this.getAllPSAppViewMsgGroups(),
      objKey,
    ) as IPSAppViewMsgGroup;
  }

  protected allpsappviewmsgs: IPSAppViewMsg[];
  getAllPSAppViewMsgs(): IPSAppViewMsg[] | null {
    return (
      this.allpsappviewmsgs ||
      (this.allpsappviewmsgs = this.fillChildListModel(
        this.M.getAllPSAppViewMsgs,
        S._86,
      ) as IPSAppViewMsg[])
    );
  }

  findPSAppViewMsg(objKey: any): IPSAppViewMsg | null {
    return this.getPSModel5(
      S._86,
      this.getAllPSAppViewMsgs(),
      objKey,
    ) as IPSAppViewMsg;
  }

  protected allpsappviews: IPSAppView[];
  getAllPSAppViews(): IPSAppView[] | null {
    return (
      this.allpsappviews ||
      (this.allpsappviews = this.fillChildListModel(
        this.M.getAllPSAppViews,
        S._1e,
      ) as IPSAppView[])
    );
  }

  findPSAppView(objKey: any): IPSAppView | null {
    return this.getPSModel5(
      S._1e,
      this.getAllPSAppViews(),
      objKey,
    ) as IPSAppView;
  }

  protected allpsappwfs: IPSAppWF[];
  getAllPSAppWFs(): IPSAppWF[] | null {
    return (
      this.allpsappwfs ||
      (this.allpsappwfs = this.fillChildListModel(
        this.M.getAllPSAppWFs,
        S._8f,
      ) as IPSAppWF[])
    );
  }

  findPSAppWF(objKey: any): IPSAppWF | null {
    return this.getPSModel5(S._8f, this.getAllPSAppWFs(), objKey) as IPSAppWF;
  }

  protected allpsdeopprivs: IPSDEOPPriv[];
  getAllPSDEOPPrivs(): IPSDEOPPriv[] | null {
    return (
      this.allpsdeopprivs ||
      (this.allpsdeopprivs = this.fillChildListModel(
        this.M.getAllPSDEOPPrivs,
        S._270,
      ) as IPSDEOPPriv[])
    );
  }

  findPSDEOPPriv(objKey: any): IPSDEOPPriv | null {
    return this.getPSModel5(
      S._270,
      this.getAllPSDEOPPrivs(),
      objKey,
    ) as IPSDEOPPriv;
  }

  protected allpssubapprefs: IPSSubAppRef[];
  getAllPSSubAppRefs(): IPSSubAppRef[] | null {
    return (
      this.allpssubapprefs ||
      (this.allpssubapprefs = this.fillChildListModel(
        this.M.getAllPSSubAppRefs,
        S._3db,
      ) as IPSSubAppRef[])
    );
  }

  findPSSubAppRef(objKey: any): IPSSubAppRef | null {
    return this.getPSModel5(
      S._3db,
      this.getAllPSSubAppRefs(),
      objKey,
    ) as IPSSubAppRef;
  }

  get appFolder(): string {
    return this.M.appFolder;
  }

  get appMode():
    | 'DEFAULT'
    | 'CLOUDHUBAPP'
    | 'CLOUDHUBSUBAPP'
    | 'WFAPP'
    | 'USER'
    | 'USER2'
    | 'USER3'
    | 'USER4' {
    return this.M.appMode;
  }

  get appTag(): string {
    return this.M.appTag;
  }

  get appTag2(): string {
    return this.M.appTag2;
  }

  get appTag3(): string {
    return this.M.appTag3;
  }

  get appTag4(): string {
    return this.M.appTag4;
  }

  get appVersion(): string {
    return this.M.appVersion;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  protected defaultappviewpssyscss: IPSSysCss;
  getDefaultAppViewPSSysCss(): IPSSysCss | null {
    return (
      this.defaultappviewpssyscss ||
      (this.defaultappviewpssyscss = this.fillObjectModel(
        S._278,
        this.M.getDefaultAppViewPSSysCss,
        S._365,
      ) as IPSSysCss)
    );
  }

  get defaultFlag(): boolean {
    return this.M.defaultFlag;
  }

  protected defaultpsappindexview: IPSAppIndexView;
  getDefaultPSAppIndexView(): IPSAppIndexView | null {
    return (
      this.defaultpsappindexview ||
      (this.defaultpsappindexview = this.fillObjectModel(
        S._7c,
        this.M.getDefaultPSAppIndexView,
        S._366,
      ) as IPSAppIndexView)
    );
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get engineVer(): number {
    return this.M.engineVer;
  }

  get pFStyle(): string {
    return this.M.pFStyle;
  }

  get pFType(): string {
    return this.M.pFType;
  }

  get pKGCodeName(): string {
    return this.M.pKGCodeName;
  }

  protected psapplicationlogics: IPSApplicationLogic[];
  getPSApplicationLogics(): IPSApplicationLogic[] | null {
    return (
      this.psapplicationlogics ||
      (this.psapplicationlogics = this.fillChildListModel(
        this.M.getPSApplicationLogics,
        S._38f,
      ) as IPSApplicationLogic[])
    );
  }

  findPSApplicationLogic(objKey: any): IPSApplicationLogic | null {
    return this.getPSModel5(
      S._38f,
      this.getPSApplicationLogics(),
      objKey,
    ) as IPSApplicationLogic;
  }

  get serviceCodeName(): string {
    return this.M.serviceCodeName;
  }

  get sysCodeName(): string {
    return this.M.sysCodeName;
  }

  get enableDynaDashboard(): boolean {
    return this.M.enableDynaDashboard;
  }

  get enableFilterStorage(): boolean {
    return this.M.enableFilterStorage;
  }

  get enableServiceAPIDTO(): boolean {
    return this.M.enableServiceAPIDTO != null
      ? this.M.enableServiceAPIDTO
      : false;
  }

  get enableUACLogin(): boolean {
    return this.M.enableUACLogin;
  }

  get enableUIModelEx(): boolean {
    return this.M.enableUIModelEx != null ? this.M.enableUIModelEx : false;
  }

  get mobileApp(): boolean {
    return this.M.mobileApp;
  }

  get useServiceApi(): boolean {
    return this.M.useServiceApi;
  }

  get wFAppMode(): boolean {
    return this.M.wFAppMode;
  }
  get cls(): string {
    return 'PSApplicationImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._26e) return true;
    return super.instanceof(cls);
  }
}
